package com.eascs.ant.data.platform;

import java.util.LinkedList;
import java.util.List;

public enum Platform {

	IFENG_NEWS("凤凰资讯" ,"ifeng_news" ),
	SINA_NEWS("新浪新闻" ,"sina_news" ),
	SINA_WEIBO("新浪微博" , "sina_weibo" ),
	NC_PRICE("农商价格行情" , "nc_price" ),
	NC_INFO("农商农业资讯" , "nc_info" ),
	ZOL_PHONE("中关村手机信息" , "zol_phone" ),
	JINGDONG_PHONE("京东手机信息" ,"jingdong_phone");
	
	private String name;//中文名字
	
	private String platform;//平台名称，mongo集合名称
	
	private Platform(String name , String platform){
		this.name = name;
		this.platform = platform;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}
	
	//获取所有平台的名称
	public static List<String> getAllPlatform(){
		List<String> list = new LinkedList<String>();
		for(Platform p : Platform.values()){
			list.add(p.getPlatform());
		}
		return list;
	}
	//根据平台名称获取平台中文名字
	public static String getName(String platform){
		for(Platform p : Platform.values()){
			if(p.getPlatform().equals(platform))
				return p.getName();
		}
		return null;
	}
	
	public static void main(String[] args) {
		for(Platform p : Platform.values()){
			if(p.getPlatform().equals("nc_info"))
				System.out.println(p.getName());
		}
	}
}
